#include <iostream>
#include <vector>

using namespace std;

double findMaxAverage(vector<int>& nums, int k) {
    int n = nums.size();
    
    double nowSum = 0;
    for(int i=0;i<k;i++){
        nowSum += nums[i];
    }
    double maxSum = nowSum;
    
    for(int i=k;i<n;i++){
        nowSum = nowSum + nums[i] - nums[i-k];
        maxSum = max(maxSum, nowSum); 
    }
    return maxSum / k;
}

int main(){
    cout << "hello world" << endl;
    vector<int> nums{1,12,-5,-6,50,3};
    cout << findMaxAverage(nums, 4);
}